var myChart = echarts.init(document.getElementById("idx1"))
var option = {
    series:{
        type:'graph',
        data:[{
            name:'小明',
            x:10,
            y:50,
        },{
            name:'小红',
            x:50,
            y:100,
        },{
            name:'老王',
            x:90,
            y:50,
        }],
        symbolSize:30,
        symbol:'triangle',
        links:[{
            source:'小明',
            target:'老王',
        },{
            source:'小红',
            target:'小明',
        },{
            source:'小红',
            target:'老王',    
        },],
    }
};
myChart.setOption(option);
//---------------------------
var myChart2 = echarts.init(document.getElementById("idx2"))
var option2 = {
    series:{
        type:'graph',
        data:[{
            name:'小明',
            x:10,
            y:50,
        },{
            name:'小红',
            x:50,
            y:100,
        },{
            name:'老王',
            x:90,
            y:50,
        }],
        symbolSize:30,
        symbol:'roundRect',
        links:[{
            source:'小明',
            target:'老王',
            lineStyle:{
                color:'green',
                width: 10,
            },
            label: {
                formatter:'邻居',
                show:true,            
            },
        },{
            source:'小红',
            target:'小明',
            lineStyle:{
                color:'red',
                width: 10,
            },
            label: {
                formatter:'恋人',
                show:true,            
            },
        },{
            source:'小红',
            target:'老王',
            lineStyle:{
                color:'yellow',
                width: 10,
            },
            label: {
                formatter:'朋友',
                show:true,            
            },
        },],
        itemStyle:{
            color:'red',
            bprderColor:'black'
        },
        label:{
            show:true,
            position:'top',
            }    
        }
};    
myChart2.setOption(option2);

var myChart3 = echarts.init(document.getElementById("idx3"))
var option3 = {
    series:{
        type:'graph',
        data:[{
            name:'小明',
            x:10,
            y:50,
        },{
            name:'小红',
            x:50,
            y:100,
        },{
            name:'老王',
            x:90,
            y:50,
        }],
        symbolSize:30,
        symbol:'image://./img/1.jpg',
        links:[{
            source:'小明',
            target:'老王',
            lineStyle:{
                color:'green',
                width: 10,
            },
            label: {
                formatter:'邻居',
                show:true,            
            },
        },{
            source:'小红',
            target:'小明',
            lineStyle:{
                color:'red',
                width: 10,
            },
            label: {
                formatter:'恋人',
                show:true,            
            },
        },{
            source:'小红',
            target:'老王',
            lineStyle:{
                color:'yellow',
                width: 10,
            },
            label: {
                formatter:'朋友',
                show:true,            
            },
        },],
        itemStyle:{
            color:'red',
            bprderColor:'black'
        },
        label:{
            show:true,
            position:'top',
            }    
        }
};    
myChart3.setOption(option3);


var myChart4 = echarts.init(document.getElementById("idx4"))
var option4 = {
    series:{
        type:'graph',
        layout:'force',
        force:{
            repulsion:1000,
        },
        roam:true,
        draggable:true,
        label:{
             show:true,
             position:'bottom',   
        },
        data:[{
            name:'小明',
            symbol:'image://./img/1.jpg',
        },{
            name:'小红',
            symbol:'image://./img/2.jpg',
        },{
            name:'老王',
            symbol:'image://./img/3.jpg',
        }],
        symbolSize:30,
        links:[{
            source:0,
            target:1,
            lineStyle:{
                color:'yellow',
                width: 10,
            },
            label:{
                formatter:'朋友',
                show:true,
            },
        },{
            source:1,
            target:2,
            lineStyle:{
                color:'green',
                width: 10,
            },
            label:{
                formatter:'恋人',
                show:true,
            },
        },{
            source:2,
            target:0,
            lineStyle:{
                color:'red',
                width: 10,
            },
            label:{
                formatter:'邻居',
                show:true,
            },
        }],
    }
};    
myChart4.setOption(option4);
//-------------------------
var myChart5 = echarts.init(document.getElementById("idx5"))
var option5 = {
    series:{
        type:'graph',
        layout: 'force',
        force: {
            repulsion: 1500,
        },
        roam: true,
        draggable: true,
        focusNodeAdjacency: true,
        label: {
            show: true,
        },
        categories: [{
            name: '学生',
            itemStyle: {
                color: 'red',
            },
        },{
            name: '工人',
            itemStyle: {
                color: 'yellow',
            },
        },{
            name: '老师',
            itemStyle: {
                color: 'green',
            },
        }],
        data: [{
            name: '小周',
            category: 0,
        },{
            name: '小赵',
            category: 1,
        },{
            name: '小钱',
            category: 0,
        },{
            name: '小李',
            category: 1,
        },{
            name: '老王',
            category: 0,
        },{
            name: '小吴',
            category: 2,
        },{
            name: '小明',
            category: 1,
        },{
            name: '小红',
            category: 2,
        },{
            name: '小孙',
            category: 2,
        },],
        symbolSize: 30,
        links:[{
            source:0,
            target:1,
        },{
            source:1,
            target:2,
        },{
            source:2,
            target:3,
        },{
            source:1,
            target:4,
        },{
            source:4,
            target:5,
        },{
            source:4,
            target:6,
        },{
            source:4,
            target:7,
        },{
            source:6,
            target:7,
        },{
            source:7,
            target:8,
        },],
    }
};
myChart5.setOption(option5);

var myChart6 = echarts.init(document.getElementById("idx6"))
var option6 = {
    series:{
        type:'graph',
        layout:'circular',
        data:[{
            name:'小明',
        },{
            name:'小红',
        },{
            name:'老王',
        },{
            name:'小赵',
        },{
            name:'小钱',
        },{
            name:'小孙',
        },{
            name:'小李',
        },],
        symbolSize:30,
        // symbol:'triangle',
        links:[{
            source:'小明',
            target:'老王',
        },{
            source:'小红',
            target:'小明',
        },{
            source:'小红',
            target:'老王',    
        },],
    }
};
myChart6.setOption(option6);